package com.micangcaihang.common.http;

import java.io.Serializable;

/**
 * <pre>
 *     author : Fandy
 *     e-mail : fandayonggmail@gmail.com
 *     time   : 2017/06/16
 *     desc   : des:封装服务器返回数据
 *     version: 1.0
 * </pre>
 */
public class ApiResult<T>  implements Serializable {
    public int status;
    public String message;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T data;

    public boolean success() {
        return 1== status;
    }

    @Override
    public String toString() {
        return "ApiResult{" +
                "status='" + status + '\'' +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
    public ApiResult toLzyResponse() {
        ApiResult apiResult = new ApiResult();
        apiResult.setStatus(getStatus());
        apiResult.setMessage(getMessage());
        return apiResult;
    }

}
